#电子秤
#能够计算:
#   价格=（毛重-包装重量）*单价
#   包装重量：0.1斤
#   价格=（毛重-0.1）*单价
# 苹果：3元/斤
# 香蕉：5元/斤

def dianzicheng(danjia):
    def jisuan(maozhong):
        return (maozhong-0.1)*danjia
    return jisuan

xiangjiao=dianzicheng(5)
print(xiangjiao(9.9))

# 等价于：
# def jisuan(maozhong):
#   return (maozhong-0.1)*5

pingguo=dianzicheng(3)
print(pingguo(10.1))

# 等价于：
# def jisuan(maozhong):
#     return (maozhong-0.1)*3
















# def price(unitPrice):
#     def computer(weight):
#         return (weight-0.1)*unitPrice
#     return computer
# apple=price(3)
# print(apple(10.1))

# banana=price(5)
# print(banana(10.1))